package cn.cdeden.knowledge.domain.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

/**
 * @ProjectName : ecm_hou
 * @Package : com.cdyd.ecm.utils.enums
 * @ClassName : DateUtilEnums
 * @Author : Yu.
 * @Description : // TODO
 * @Date : 2023/2/3 11:31
 * @Version : 1.0
 */
@Getter
@AllArgsConstructor
public enum DateUtilEnums {

    YMD_HMS("YMD_HMS","yyyy-MM-dd HH:mm:ss","%Y-%m-%d %H:%m:%s"),
    YMD("YMD","yyyy-MM-dd","%Y-%m-%d"),
    YM("YM","yyyy-MM","%Y-%m"),
    Y("Y","yyyy","%Y"),
    HMS("HMS","HH:mm:ss","%H:%m:%s"),


    ;

    private final String code;
    private final String textJava;
    private final String textSql;



    public static DateUtilEnums find(String code) {
        for (DateUtilEnums value : DateUtilEnums.values()) {
            if (
                    StringUtils.equalsIgnoreCase(code,value.getCode())
            ) {
                return value;
            }
        }
        return null;
    }


}
